import com.github.difflib.DiffUtils
import com.github.difflib.patch.Patch
import org.junit.jupiter.api.Test
import java.lang.invoke.MethodHandles.Lookup.ORIGINAL


/**
 * @Author ZhouHang
 * @Date 24/7/4 周四
 */
class DiffTest {
    @Test fun `Test Diff`() {
        val original: List<String> = listOf("com.A", "com.B", "com.C")
        val revised: List<String> = listOf("com.A", "com.B", "com.D", "com.C")

        val patch: Patch<String> = DiffUtils.diff(original, revised)

        for (delta in patch.deltas) {
            println(delta.type)
            println(delta.source)
            println(delta.target.lines[0])
            println(delta.javaClass)
        }
    }

    @Test fun `Test Substring`() {
        val str = "package:com.google.android.configupdater"
        println(str.substring(8))
    }
}